<%@ page language="java" errorPage="/common/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="../style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/admin/assets/js/util.js"></script>
<script language="javascript">
function check()
{
    var oldPwd = document.getElementById("oldPwd");
	var newPwd = document.getElementById("newPwd");
	var newPwd1 = document.getElementById("newPwd1");
	if(oldPwd.value=="")
	{
		OS.showWarming("errorTd","请输入原始密码！");
		oldPwd.focus();
		return false;
	}
	else
	{
		OS.hideWarming("errorTd");
	}
	
	if(newPwd.value=="")
	{
		OS.showWarming("errorTd","请输入新密码！");
		newPwd.focus();
		return false;
	}
	else
	{
		OS.hideWarming("errorTd");
	}
	
	if(newPwd.value!=newPwd1.value)
	{
		OS.showWarming("errorTd","两次密码不一致！");
		newPwd.focus();
		return false;
	}
	else
	{
		OS.hideWarming("errorTd");
	}

	dojo.io.bind({
			url: "admin.aos?method=changePwd",
			formNode:dojo.byId("passwordForm"),
			mimetype:"text/html",
			method:"POST",
			encoding:"UTF-8",
			timeout:10000, 
			preventCache:true,
			load: function(type, data, evt){
				if(data=="success")
				{
					OS.showCue("errorTd","更新成功!");
				}
				else
				{
					OS.showWarming("errorTd","原始密码不正确!")
				}
			},
			error: function(type, error){
				
			},
			timeout: function(type, data, evt){
				
			}
		});
		return false;
}

window.onload = function()
{
	
}
</script>

</head>
<body class="main">
<form method="post" name="passwordForm" id="passwordForm" action="" onSubmit="return check()">
<input type="hidden" name="adminId" value="<%=request.getParameter("id")%>">
<table class="container" cellpadding="0" cellspacing="0">
<tr><td>
<table class="dialog" align="center" cellpadding="0" cellspacing="0" width="400">
<tr><td>
<table class="header" cellpadding="0" cellspacing="0">
<tr>
<td>修改密码</td>
</tr>
</table>
</td></tr>
<tr><td>
<table class="body" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2" align="center" id="errorTd">&nbsp;</td>
  </tr>
<tr>
  <td align="right"><strong>原始密码：</strong></td>
  <td><input type="password" name="oldPwd" id="oldPwd" size="25" maxlength="20"/></td>
</tr>
<tr>
<td align="right"><b>新密码：</b></td>
<td><input type="password" name="newPwd" id="newPwd" size="25" maxlength="20"/></td>
</tr>
<tr>
<td align="right"><b>确认密码：</b></td>
<td><input type="password" name="newPwd1" id="newPwd1" size="25" maxlength="20"></td>
</tr>
<tr>
  <td colspan="2">&nbsp;</td>
  </tr>
</TABLE>
</td></tr>
<tr><td>
<table class="footer" cellpadding="0" cellspacing="0">
<tr><td>
<input class="button" type="submit" value="确定">
&nbsp;&nbsp;<input class="button" type="button" value="返回" onClick="javascript:history.go(-1)">
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>

</body>
</html>
